import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/**
 * Created by lanouhn on 17/7/18.
 */
public class callMain {

    public static void main(String [] args) throws ExecutionException, InterruptedException {
        //实现Callable接口的线程，需要使用futrue来启动
        FutureTask<Integer> ft = new FutureTask<Integer>(new CallableThread());

        //thread启动线程
        new Thread(ft).start();
        //获取线程执行结果
        try{
            int num = ft.get();
            System.out.println(num);
        }catch (InterruptedException e){
            e.printStackTrace();
        }catch (ExecutionException e){
            e.printStackTrace();
        }

    }
}
